export default {
  name: 'routerLink',
  props: {
    to: {
      type: String,
      required: true
    },
    tag: {
      type: String,
      default: 'a'
    }
  },
  methods: {
    handleClick(to) {
      this.$router.push(to)
    }
  },
  render() {
    let { tag, to } = this
    // jsx语法
    return (
      <tag on-click={this.handleClick.bind(this, to)}>
        {this.$slots.default}
      </tag>
    )
  }
}
